home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
program
/
n_b_v203.zip
/
COMP_RAY.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
4KB
|
73 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-11-15 ╟─╖
│ │ FILE NAME COMP_RAY.DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
RayPoint like it's big cousin PolygonPoint computes the X,Y position of a
ray given certain information about the circle being used. It assumes that
Point number 0 is at 12:00 (North) and that the points move clockwise
around the circle. This makes it especially handy for clocks, timers and
the like.
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
$INCLUDE "PUBLICS.INC" ' uses pPi#
$INCLUDE "DAS-NBV1.INC" '
'
CLS '
SCREEN 12 ' works better than text mode :)
GraphicSETUP '
COLOR 9 '
LOCATE 29, 30 '
PRINT "Press any key to quit."; '
'
' A SIMPLE CLOCK
X% = 320 : Y% = 232 ' center coordinates
DO '
FOR I% = 50 TO 70 STEP 2 ' Clock border
CIRCLE (X%,Y%), I%, 9 '
NEXT '
CIRCLE (X%,Y%), I%-1, 9 '
CIRCLE (X%,Y%), 2, 15 ' center stem
PAINT (X%,Y%), 15, 15 '
LOCATE 14, 38 : PRINT "DASoft" ' infomerical
'
FOR I% = 0 TO 11 ' 12 number buttons
RayPoint X%, Y%, 50, 1, 12, I%, C%, R% ' compute coordinates
CIRCLE (C%,R%), 2, 14 ' draw circle
PAINT (C%,R%), 14, 14 ' fill it
NEXT '
H% = VAL( TIME$ ) ' Hours
M% = VAL( MID$( TIME$, 4 ) ) ' Minutes
RayPoint X%, Y%, 35, 1, 12, H%, C%, R% ' compute hour hand
LINE ( X%, Y% ) - ( C%, R% ), 15 ' draw it
RayPoint X%, Y%, 45, 1, 60, M%, C%, R% ' compute minute hand
LINE ( X%, Y% ) - ( C%, R% ), 15 ' draw it
DO ' seconds
S% = VAL( MID$( TIME$, 7 ) ) '
RayPoint X%, Y%, 49, 1, 60, S%, C%, R% ' compute
GLineDRAW X%, Y%, C%, R%, 0, 2, 12 ' XOR on the second hand
WHILE S% = VAL( MID$( TIME$, 7 ) ) ' wait a second
WEND '
GLineDRAW X%, Y%, C%, R%, 0, 2, 12 ' XOR off the second hand
IF INSTAT THEN EXIT, EXIT ' press any key to exit
LOOP UNTIL S% = 0 ' redraw to set minute hand
CLS '
LOOP '
CLS
SCREEN 0